<%@ Page Language="VB" AutoEventWireup="false" CodeFile="SQAbout.aspx.vb" Inherits="SAD_SQAbout" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>

<script type="text/javascript" language="javascript">
function getStatus() {
	var xmlhttp = false;
	
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest && !(window.ActiveXObject)) {
    	try {
			xmlhttp = new XMLHttpRequest();
        } catch(e) {
			xmlhttp = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
       	try {
        	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
      	} catch(e) {
        	try {
          		xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        	} catch(e) {
          		xmlhttp = false;
        	}
		}
    }
	if(xmlhttp) {
		xmlhttp.onreadystatechange = function() { alertContents(xmlhttp); };
		xmlhttp.open("GET",'http://<%= HttpContext.Current.Session("BASEDIR") %>/SAD/SQSUM.aspx', true);
		xmlhttp.send(null);
		//alertContents(xmlhttp);
	}
}

function alertContents(xmlhttp)
{ 
	switch(xmlhttp.readyState)
	{
		case 0:
			//Uninitialized;
			break;

		case 1:
			//Loading
			break;

		case 2:
			//Loaded
			break;

		case 3:
			//Interactive
			break;

		case 4:
			//Complete
			var oStatus=document.getElementById('divStatusSummary');
			
            if (xmlhttp.status == 200) {
            	//OK response received
                oStatus.innerHTML=xmlhttp.responseText;

				break;
				
            } else {
            	//Some kind of error.
                oStatus.innerHTML='There was a problem with the request. Status Code: ' + xmlhttp.status;
            }
            
			break;
	}
}

function NewWindowForPrinting()
{
    var WinRef = window.open('','Server_Overview','width=515,height=600'
                           +',menubar=1'
                           +',toolbar=1'
                           +',status=0'
                           +',scrollbars=1'
                           +',resizable=1');
   
    var oContent=document.getElementById('divStatusSummary');
    WinRef.document.write('<html>');
    WinRef.document.write('<head>');
    WinRef.document.write('<title>Server Overview</title>');
    WinRef.document.write('</head>');
    WinRef.document.write('<body style=\"font-size: 10px;\"/>');
    WinRef.document.write(oContent.innerHTML);  
    WinRef.document.write('</body>');
    WinRef.document.write('</html>');
    WinRef.document.close();
}

function setToolbarAction(varAction)
{
    var oAction=document.getElementById("hidToolbarAction");
    oAction.value=varAction;

    document.form1.submit();
    
    return true;
}

function setCurrentTab(varAction)
{
    var oAction=document.getElementById("hidCurrentTab");
    oAction.value=varAction;
    
    return true;
}
    
function ShowStatus()
{
    setCurrentTab('ShowStatus');
    
    //panels
    var oStatus=document.getElementById('divStatusSummary');
    var oSMTP=document.getElementById('divEmailSettings');
    var oSAD=document.getElementById('divSADSettings');
    var oSYSC=document.getElementById('divSysConfig');
    
    //tabs
    var oTDStatus=document.getElementById('tdStatus');
    var oTDSMTP=document.getElementById('tdSMTP');
    var oTDSAD=document.getElementById('tdSAD');
    var oSysConfig=document.getElementById('tdSysConfig');
    
    //toolbar buttons
    var tblUpdate=document.getElementById('cmdUpdate');
    var tblRefresh=document.getElementById('ARefresh');
    var tblPrint=document.getElementById('cmdPrint');
    
    oStatus.style.visibility='visible';
    oTDStatus.style.backgroundColor='yellow';
    tblRefresh.style.visibility='visible';
    tblPrint.style.visibility='visible';
    
    oSMTP.style.visibility='hidden';
    oTDSMTP.style.backgroundColor='white';
    tblUpdate.style.visibility='hidden';
 
    oSAD.style.visibility='hidden';
    oTDSAD.style.backgroundColor='white';
    
    oSYSC.style.visibility='hidden';
    oSysConfig.style.backgroundColor='white';
    
    oStatus.innerHTML='<h4>Retrieving Summary Report</h4>';
    getStatus();
}

function ShowSMTP()
{
    setCurrentTab('ShowSMTP');
    
    //panels
    var oStatus=document.getElementById('divStatusSummary');
    var oSMTP=document.getElementById('divEmailSettings');
    var oSAD=document.getElementById('divSADSettings');
    var oSYSC=document.getElementById('divSysConfig');
    
    //tabs
    var oTDStatus=document.getElementById('tdStatus');
    var oTDSMTP=document.getElementById('tdSMTP');
    var oTDSAD=document.getElementById('tdSAD');
    var oSysConfig=document.getElementById('tdSysConfig');
    
    //toolbar buttons
    var tblUpdate=document.getElementById('cmdUpdate');
    var tblRefresh=document.getElementById('ARefresh');
    var tblPrint=document.getElementById('cmdPrint');
    
    oSMTP.style.visibility='visible';
    oTDSMTP.style.backgroundColor='yellow';
    tblUpdate.style.visibility='visible';
    
    oStatus.style.visibility='hidden';
    oTDStatus.style.backgroundColor='white';
    tblRefresh.style.visibility='hidden';
    tblPrint.style.visibility='hidden';
    
    oStatus.style.visibility='hidden';
    oTDStatus.style.backgroundColor='white';
    
    oSAD.style.visibility='hidden';
    oTDSAD.style.backgroundColor='white';
    
    oSYSC.style.visibility='hidden';
    oSysConfig.style.backgroundColor='white';
}

function ShowAutoDoc()
{
    setCurrentTab('ShowAutoDoc');
    
    //panels
    var oStatus=document.getElementById('divStatusSummary');
    var oSMTP=document.getElementById('divEmailSettings');
    var oSAD=document.getElementById('divSADSettings');
    var oSYSC=document.getElementById('divSysConfig');
    
    //tabs
    var oTDStatus=document.getElementById('tdStatus');
    var oTDSMTP=document.getElementById('tdSMTP');
    var oTDSAD=document.getElementById('tdSAD');
    var oSysConfig=document.getElementById('tdSysConfig');
    
    //toolbar buttons
    var tblUpdate=document.getElementById('cmdUpdate');
    var tblRefresh=document.getElementById('ARefresh');
    var tblPrint=document.getElementById('cmdPrint');
    
    oSAD.style.visibility='visible';
    oTDSAD.style.backgroundColor='yellow';
    tblUpdate.style.visibility='visible';
    
    oSMTP.style.visibility='hidden';
    oTDSMTP.style.backgroundColor='white';
    
    oStatus.style.visibility='hidden';
    oTDStatus.style.backgroundColor='white';
    
    tblRefresh.style.visibility='hidden';
    tblPrint.style.visibility='hidden';
    
    oSYSC.style.visibility='hidden';
    oSysConfig.style.backgroundColor='white';
}

function ShowSysConfig()
{
    setCurrentTab('ShowSysConfig');
    
    //panels
    var oStatus=document.getElementById('divStatusSummary');
    var oSMTP=document.getElementById('divEmailSettings');
    var oSAD=document.getElementById('divSADSettings');
    var oSYSC=document.getElementById('divSysConfig');
    
    //tabs
    var oTDStatus=document.getElementById('tdStatus');
    var oTDSMTP=document.getElementById('tdSMTP');
    var oTDSAD=document.getElementById('tdSAD');
    var oSysConfig=document.getElementById('tdSysConfig');
    
    //toolbar buttons
    var tblUpdate=document.getElementById('cmdUpdate');
    var tblRefresh=document.getElementById('ARefresh');
    var tblPrint=document.getElementById('cmdPrint');
    
    tblRefresh.style.visibility='hidden';
    tblPrint.style.visibility='hidden';
    
    oSAD.style.visibility='hidden';
    oTDSAD.style.backgroundColor='white';
    
    oSMTP.style.visibility='hidden';
    oTDSMTP.style.backgroundColor='white';
    
    oStatus.style.visibility='hidden';
    oTDStatus.style.backgroundColor='white';
    
    oSYSC.style.visibility='visible';
    oSysConfig.style.backgroundColor='yellow';
    tblUpdate.style.visibility='visible';
}

function onLoad()
{
    var TopWindow=top.window.document;
    
    var DashTitle=TopWindow.getElementById('DashboardTitle');
    var DashMode=TopWindow.getElementById('DMode');
            
    var RServer=TopWindow.getElementById('SID');
    var RDatabase=TopWindow.getElementById('DID');
    
    DashTitle.innerHTML='Welcome to SQLAutoDoc';
    DashMode.value='Server';
    RServer.value='';
    RDatabase.value='';           
    
    var oTab=document.getElementById('hidCurrentTab');
    switch (oTab.value)
    {
        case 'ShowStatus':
            ShowStatus();
            break;
            
        case 'ShowSMTP':
            ShowSMTP();
            break;
            
        case 'ShowAutoDoc':
            ShowAutoDoc();
            break;
            
        case 'ShowSysConfig':
            ShowSysConfig();
            break;
        
        default:
            //If SMTP server hasn't been specified, show SMTP settings otherwise
            //show reporting settings
            var SMTPServer = document.getElementById('txtSMTP');
            if (SMTPServer.length==0)
                ShowSMTP();
            else
                ShowAutoDoc();
                
                break;
    }
}
</script>

<body onload="onLoad();">
    <form id="form1" runat="server">
    <div>
        <table width="100%" style="border-collapse:collapse;">
        <tr class="wmObjectDetailDev_TH" style="height: 30px; border-collapse: collapse; background-color: #C3C4C1; border-bottom: solid 1px black;">
            <td style="width:300px; font-weight: bold; padding-left: 5px;">
                Welcome to SQLAutoDoc
            </td>

            <td style="width:25px;">                
                <input type="image"
                    src="images/tb_add.jpg"
                    title="Add New Server"
                    id="cmdAddServer"
                    name="cmdAddServer"
                    value="Add New Server"
                    onclick="setToolbarAction('newsvr');"/>
            </td>
            
            <td style="width:25px;">
                <input type="image"
                       src="images/tb_save.jpg"
                       id="cmdUpdate"
                       name="cmdUpdate"
                       title="Update Configuration Info"
                       alt="Update Configuration"
                       onclick="setToolbarAction('update');"
                       value="Update Configuration Info"/>
            </td>  
                      
            <td style="width:25px;"> 
                <a href="" 
                    runat="server" 
                    id="ARefresh">
                <img src="images/tb_refresh.jpg"   
                     title="Refresh"
                     alt="Refresh" 
                     onclick="javascript:document.form1.submit();" 
                     border="0" />
                </a>
            </td>
            
            <td style="width:25px;"> 
                <input type="image"
                        id="cmdPrint"
                       src="images/tb_newwindow.jpg"
                       onclick="javascript:NewWindowForPrinting();"  
                       title="View in seperate window for printing"
                       alt="View in seperate window for printing" />
            </td>   
            
            <td>&nbsp;</td>
        </tr>
    </table>
 
        <table style="margin-left: 15px; margin-top: 10px;" cellspacing="5" cellpadding="2">
            <tr>
                <td id="tdStatus" style="width: 100px; text-align:center; font-family: Arial; font-size: 10px; border: solid 1px gray;">
                    <a href="javascript:ShowStatus();" title="Status Summary">
                        Status Summary
                    </a>
                </td>

                <td id="tdSMTP" style="width: 100px; text-align:center; font-family: Arial; font-size: 10px; border: solid 1px gray;">
                     <a href="javascript:ShowSMTP();" title="SMTP Mail Settings">
                        SMTP Mail Settings
                    </a>               
                </td>
                                
                <td id="tdSAD" style="width: 100px; text-align:center; font-family: Arial; font-size: 10px; border: solid 1px gray;">
                     <a href="javascript:ShowAutoDoc();" title="AutoDoc">
                        AutoDoc Settings
                    </a>               
                </td>
                
                <td id="tdSysConfig" style="width: 100px; text-align:center; font-family: Arial; font-size: 10px; border: solid 1px gray;">
                     <a href="javascript:ShowSysConfig();" title="System Configuration">
                        System Configuration
                    </a>               
                </td>
            </tr>
        </table>
        
        <div id="divStatusSummary" style="visibility: visible; border-collapse: collapse; height:1005px; width:435px; padding-left: 20px; padding-top: 10px; margin-top:20px; margin-left: 15px; left: 8px; position:absolute; top: 90px;" runat="server">

        </div>
                       
        <div id="divEmailSettings" style="visibility: hidden; border: solid 1px black; border-collapse: collapse; height:215px; width:435px; padding-left: 20px; padding-top: 10px; margin-top:20px; margin-left: 15px; left: 8px; position:absolute; top: 90px;">
            <div id="divTitle2" style="text-align:center; border: solid 1px black; background-color:LightGrey; width: 415px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; margin-bottom: 10px;">
                SMTP Email Server Settings
            </div>
            
            <table style="width:415px; border: solid 1px black; border-collapse: collapse; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;">           
                <tr style="height: 30px; vertical-align:bottom;">
                    <td style="text-align:right; padding-right: 10px; padding-top:5px;">SMTP Server</td>
                    <td style="padding-top:5px;">
                    <input type="text" id="txtSMTP" maxlength="255" runat="server" style="width: 210px" />
                    <div id="errSMTP" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
                
                <tr style="height: 25px; vertical-align:bottom;">
                    <td style="text-align:right; padding-right: 10px;">User ID (if required)</td>
                    <td>
                    <input type="text" id="txtUID" maxlength="255" runat="server" style="width: 210px" />
                    <div id="errUID" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
                
                <tr style="height: 25px; vertical-align:bottom;">
                    <td style="text-align:right; padding-right: 10px;">Password (if required)</td>
                    <td>
                    <input type="text" id="txtPWD" maxlength="255" runat="server" style="width: 210px" />
                    <div id="errPWD" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
                
                <tr style="height: 25px; vertical-align:bottom; ">
                    <td style="text-align:right; padding-right: 10px;">From Address</td>
                    <td>
                    <input type="text" id="txtFrom" maxlength="255" runat="server" style="width: 210px" value="sqlautodoc@jlion.com" />
                    <div id="errFrom" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
                
                <tr style="height: 30px; vertical-align:bottom;">
                    <td style="text-align:right; padding-right: 10px; padding-bottom: 5px;">Default To Address(es)</td>
                    <td style="padding-bottom: 5px;">
                    <input type="text" id="txtTo" maxlength="255" runat="server" style="width: 210px"/>
                    <div id="errTo" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
                
                <tr>
                    <td>&nbsp;</td>
                    <td>
                        <input type="button" value="Send Test Message" onclick="setToolbarAction('testmessage');" />
                         <div id="errSend" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
            </table>
        </div>
        
        <div id="divSADSettings" style="visibility: hidden; border: solid 1px black; border-collapse: collapse; height:215px; width:435px; padding-left: 20px; padding-top: 10px; margin-top:20px; margin-left: 15px; left: 8px; position:absolute; top: 90px;">
            <div id="divTitle3" style="text-align:center; border: solid 1px black; background-color:LightGrey; width: 415px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; margin-bottom: 10px;">
                SQL Auto Doc Settings
            </div>
            
            <table style="width:415px; border: solid 1px black; border-collapse: collapse; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;">           
                <tr>
                    <td colspan="2">
                    <input type="checkbox" id="chkIsActive" runat="server" /> Status Summary Report
                    </td>
                </tr>
                
                <tr style="height: 30px; vertical-align:bottom;">
                    <td style="text-align:right; padding-right: 10px; padding-top:5px;">Every:</td>
                    <td style="padding-top:5px;">
                    <input type="text" id="txtDelayDays" maxlength="2" runat="server" style="width: 40px" /> day(s)
                    <div id="Div3" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>

                <tr style="height: 30px; vertical-align:bottom;">
                    <td style="text-align:right; padding-right: 10px; padding-top:5px;">At </td>
                    <td style="padding-top:5px;">
                    <input type="text" id="txtHour" maxlength="2" runat="server" style="width: 20px" />Hr
                    :<input type="text" id="txtMinute" maxlength="2" runat="server" style="width: 20px" />Mn
                    <input type="radio" id="rdAM" runat="server" />AM
                    <input type="radio" id="rdPM" runat="server" />PM
                    <div id="Div1" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
                                
                <tr style="height: 30px; vertical-align:bottom;">
                    <td style="text-align:right; padding-right: 10px; padding-bottom:10px; padding-top:5px;">To these Email Address(es)</td>
                    <td style="padding-bottom:10px; padding-top:5px;">
                    <input type="text" id="txtServerReportEmail" maxlength="255" runat="server" style="width: 180px" />
                    <div id="Div4" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
                
                <tr style="height: 30px; vertical-align:bottom;">
                    <td style="text-align:right; padding-right: 10px; padding-bottom:10px; padding-top:5px;">Server path for emailed URLs</td>
                    <td style="padding-bottom:10px; padding-top:5px;">
                    http://<input type="text" id="txtRootURL" maxlength="255" runat="server" style="width: 180px" />
                    <div id="errRootURL" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>                
           </table>
        </div>
        
        <div id="divSysConfig" style="visibility: hidden; border: solid 1px black; border-collapse: collapse; height:305px; width:435px; padding-left: 20px; padding-top: 10px; margin-top:20px; margin-left: 15px; left: 8px; position:absolute; top: 90px;">
            <div id="div5" style="text-align:center; border: solid 1px black; background-color:LightGrey; width: 415px; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; margin-bottom: 10px;">
                System Configuration Settings
            </div>
            
            <table style="width:415px; border: solid 1px black; border-collapse: collapse; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px;">           
                <tr style="height: 30px; vertical-align:bottom;">
                    <td style="text-align:right; padding-right: 10px; padding-top:5px;">Service Interval</td>
                    <td style="padding-top:5px;">
                    <input type="text" id="txtServiceInterval" maxlength="10" runat="server" style="width: 50px" /> Milliseconds
                    <div id="Div6" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
                
                <tr style="height: 25px; vertical-align:bottom;">
                    <td style="text-align:right; padding-right: 10px;">Size Data Retention</td>
                    <td>
                    <input type="text" id="txtSizeRetention" maxlength="10" runat="server" style="width: 50px" /> Days
                    <div id="Div7" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
                
                <tr style="height: 25px; vertical-align:bottom;">
                    <td style="text-align:right; padding-right: 10px;">Blocking Data Retention</td>
                    <td>
                    <input type="text" id="txtBlockingRetention" maxlength="10" runat="server" style="width: 50px" /> Days
                    <div id="Div8" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
                
                <tr style="height: 25px; vertical-align:bottom; ">
                    <td style="text-align:right; padding-right: 10px;">Connection Data Retention</td>
                    <td>
                    <input type="text" id="txtConnectionRetention" maxlength="10" runat="server" style="width: 50px" /> Days
                    <div id="Div9" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
                
                <tr style="height: 30px; vertical-align:bottom;">
                    <td style="text-align:right; padding-right: 10px; padding-bottom: 5px;">Waitstate Data Retention</td> 
                    <td style="padding-bottom: 5px;">
                    <input type="text" id="txtWaitstateRetention" maxlength="10" runat="server" style="width: 50px"/> Days
                    <div id="Div10" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
                
                <tr style="height: 25px; vertical-align:bottom;">
                    <td style="text-align:right; padding-right: 10px;">Size Scan Timeout</td>
                    <td>
                    <input type="text" id="txtSizeTimeout" maxlength="10" runat="server" style="width: 50px" /> Minutes
                    <div id="Div2" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
                
                <tr style="height: 25px; vertical-align:bottom;">
                    <td style="text-align:right; padding-right: 10px;">Blocking Scan Timeout</td>
                    <td>
                    <input type="text" id="txtBlockingTimeout" maxlength="10" runat="server" style="width: 50px" /> Minutes
                    <div id="Div11" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
                
                <tr style="height: 25px; vertical-align:bottom; ">
                    <td style="text-align:right; padding-right: 10px;">Connection Scan Timeout</td>
                    <td>
                    <input type="text" id="txtConnectionTimeout" maxlength="10" runat="server" style="width: 50px" /> Minutes
                    <div id="Div12" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>
                
                <tr style="height: 30px; vertical-align:bottom;">
                    <td style="text-align:right; padding-right: 10px; padding-bottom: 5px;">Waitstate Scan Timeout</td> 
                    <td style="padding-bottom: 5px;">
                    <input type="text" id="txtWaitStateTimeout" maxlength="10" runat="server" style="width: 50px"/> Minutes
                    <div id="Div13" visible="false" class="wmErrorMessage" runat="server">No Error</div> 
                    </td>
                </tr>                
            </table>
        </div>
        
        <input type="hidden" id="hidToolbarAction" runat="server" />
        <input type="hidden" id="hidCurrentTab" runat="server" />
    </div>
    </form>
</body>
</html>
